import 'package:safetymonitor/app/components/custom_app_bar.dart';
import 'package:safetymonitor/app/core/core.dart';
import 'package:safetymonitor/modules/home/statistical_analysis/on_offline_device/off/off_view.dart';
import 'package:safetymonitor/modules/home/statistical_analysis/on_offline_device/on/on_view.dart';
import 'controller.dart';

///在线离线设备
class OnOfflineDevicePage extends StatelessWidget {
  OnOfflineDevicePage({super.key});

  final controller = Get.put(OnOfflineDeviceController());

  @override
  Widget build(BuildContext context) {
    return GetBuilder(
      init: controller,
      builder: (_) {
        return Scaffold(
          appBar: CustomAppBar(
            titleText: '设备',
          ),
          body: Column(
            children: [
              Container(
                padding: EdgeInsets.symmetric(horizontal: 6.w),
                decoration: BoxDecoration(
                  color: Colors.white,
                  borderRadius: BorderRadius.circular(8),
                ),
                height: AppDimens.dp54,
                child: TabBar(
                  controller: controller.tabController,
                  tabs: const [
                    Tab(text: '在线'),
                    Tab(text: '离线'),
                  ],
                  dividerColor: Colors.transparent,
                  labelPadding:
                      EdgeInsets.only(bottom: 10.w, left: 6.w, right: 6.w),
                  labelStyle: TextStyle(
                    fontSize: 16.sp,
                    fontWeight: FontWeight.w500,
                  ),
                  unselectedLabelStyle: TextStyle(
                    fontSize: 16.sp,
                    fontWeight: FontWeight.w500,
                  ),
                  labelColor: Colors.black,
                  unselectedLabelColor: const Color(0xffA0A7B5),
                  indicatorPadding: EdgeInsets.only(top: 36.w, bottom: 10.w),
                  indicator: const BoxDecoration(
                    image: DecorationImage(
                      image: AssetImage(
                        'assets/images/icon_select_arc.png',
                      ),
                    ),
                  ),
                ),
              ),
              Expanded(
                  child: Container(
                color: const Color(0xffF5F5F6),
                child: TabBarView(
                  controller: controller.tabController,
                  children: [
                    OnPage(),
                    OffPage(),
                  ],
                ),
              )),
            ],
          ),
        );
      },
    );
  }
}
